﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using SC2parser.Model;

namespace SC2parser.UserControls
{
    public partial class PlayerView : UserControl
    {
        public PlayerView()
        {
            InitializeComponent();
            lPlayerName.Location = new Point((this.Size.Width - TextRenderer.MeasureText(lPlayerName.Text, lPlayerName.Font).Width) / 2, lPlayerName.Location.Y);
        }

        public PlayerView(Player player)
        {
            InitializeComponent();
            lPlayerName.Text = player.Name;
            lPlayerName.Location = new Point((this.Size.Width - TextRenderer.MeasureText(lPlayerName.Text, lPlayerName.Font).Width) / 2, lPlayerName.Location.Y);

            FileInfo f = new FileInfo(player.Name);
            if (f.Length > 2000)
            {
                pbPlayer.Image = Image.FromFile(player.Name);
            }
        }

        public void SetPlayer(Player player)
        {
            lPlayerName.Text = player.Name;
            
            FileInfo f = new FileInfo(player.Name);
            if (f.Length > 2000)
            {
                pbPlayer.Image = Image.FromFile(player.Name);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {

        }

    }
}
